/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistencia;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hellen
 */
@Entity
@Table(name = "ORDEN_COMPRA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrdenCompra.findAll", query = "SELECT o FROM OrdenCompra o"),
    @NamedQuery(name = "OrdenCompra.findByOrdenCompraID", query = "SELECT o FROM OrdenCompra o WHERE o.ordenCompraID = :ordenCompraID")})
public class OrdenCompra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "OrdenCompraID")
    private Integer ordenCompraID;
    @JoinColumn(name = "OrdC_ProveedorID", referencedColumnName = "ProveedorID")
    @ManyToOne(optional = false)
    private Proveedor ordCProveedorID;
    @JoinColumn(name = "OrdC_ProductoID", referencedColumnName = "ProductoID")
    @ManyToOne(optional = false)
    private Producto ordCProductoID;
    @JoinColumn(name = "OrdC_EmpleadoID", referencedColumnName = "EmpleadoID")
    @ManyToOne(optional = false)
    private Empleado ordCEmpleadoID;

    public OrdenCompra() {
    }

    public OrdenCompra(Integer ordenCompraID) {
        this.ordenCompraID = ordenCompraID;
    }

    public Integer getOrdenCompraID() {
        return ordenCompraID;
    }

    public void setOrdenCompraID(Integer ordenCompraID) {
        this.ordenCompraID = ordenCompraID;
    }

    public Proveedor getOrdCProveedorID() {
        return ordCProveedorID;
    }

    public void setOrdCProveedorID(Proveedor ordCProveedorID) {
        this.ordCProveedorID = ordCProveedorID;
    }

    public Producto getOrdCProductoID() {
        return ordCProductoID;
    }

    public void setOrdCProductoID(Producto ordCProductoID) {
        this.ordCProductoID = ordCProductoID;
    }

    public Empleado getOrdCEmpleadoID() {
        return ordCEmpleadoID;
    }

    public void setOrdCEmpleadoID(Empleado ordCEmpleadoID) {
        this.ordCEmpleadoID = ordCEmpleadoID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ordenCompraID != null ? ordenCompraID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrdenCompra)) {
            return false;
        }
        OrdenCompra other = (OrdenCompra) object;
        if ((this.ordenCompraID == null && other.ordenCompraID != null) || (this.ordenCompraID != null && !this.ordenCompraID.equals(other.ordenCompraID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistencia.OrdenCompra[ ordenCompraID=" + ordenCompraID + " ]";
    }
    
}
